HAL RTC control functions migration

This section provides information about the HAL RTC control functions migration.

Note

The RTC handle is removed in HAL2, so for the following RTC HAL2 functions, the handle will be removed from the parameters.

Related concept: Other HAL RTC changes

HAL RTC wait for synchro

HAL1

HAL2

HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc)
static hal_status_t RTC_WaitSynchro_RS(void)
static hal_status_t RTC_WaitSynchro_SHP(void)
static hal_status_t RTC_WaitSynchro_RECALP(void)
static hal_status_t RTC_WaitSynchro_WUTW(void)

HAL RTC set smooth calibration

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc,
                                           uint32_t SmoothCalibPeriod,
                                           uint32_t SmoothCalibPlusPulses,
                                           uint32_t SmoothCalibMinusPulsesValue)
hal_status_t HAL_RTC_EnableCalibration(hal_rtc_calibration_period_t calibration_period,
                                       hal_rtc_calibration_pulse_t pulse_add,
                                       uint32_t subtracted_pulses)

hal_status_t HAL_RTC_DisableCalibration(void)

HAL RTC set low power calibration

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetLowPowerCalib(RTC_HandleTypeDef *hrtc,
                                             uint32_t LowPowerCalib)
hal_status_t HAL_RTC_EnableUltraLowPowerMode(void)

hal_status_t HAL_RTC_DisableUltraLowPowerMode(void)

HAL RTC set synchro shift

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc,
                                            uint32_t ShiftAdd1S,
                                            uint32_t ShiftSubFS)
hal_status_t HAL_RTC_ShiftCalibration(hal_rtc_calibration_shift_second_t add_one_sec,
                                      uint32_t fraction_sec_to_subtract)

HAL RTC set calibration output

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc,
                                                 uint32_t CalibOutput)
hal_status_t HAL_RTC_OUTPUT_SetConfigCalib(const hal_rtc_output_calib_config_t *p_config)

HAL RTC deactivate calibration output

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_OUTPUT_Disable(void)

HAL RTC set reference clock

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_EnableReferenceClock(void)

HAL RTC deactivate reference clock

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_DisableReferenceClock(void)

HAL RTC enable bypass shadow

The functions EnableBypassShadow and DisableBypassShadow are no more available and the equivalent is automatically handled by HAL_RTC_CALENDAR_SetConfig() function.

No need for the user to manipulate shadowByPass (enable/disable) at HAL level. if needed user can use the LL function if needed to go down in the abstraction.

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc)
HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc)
HAL function: hal_status_t HAL_RTC_CALENDAR_SetConfig(const hal_rtc_calendar_config_t *p_config_calendar)

LL function: __STATIC_INLINE void LL_RTC_EnableBypassShadowReg(void)
             __STATIC_INLINE void LL_RTC_DisableBypassShadowReg(void)

HAL RTC monotonic counter increment

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterIncrement(RTC_HandleTypeDef *hrtc,
                                                      uint32_t Instance)
hal_status_t HAL_TAMP_MONOTONIC_IncrementCounter(hal_tamp_monotonic_counter_t index)

HAL RTC monotonic counter get

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_MonotonicCounterGet(RTC_HandleTypeDef *hrtc,
                                                uint32_t Instance,
                                                uint32_t *Value)
uint32_t HAL_TAMP_MONOTONIC_GetCounter(hal_tamp_monotonic_counter_t index)

HAL RTC set SSRU IT

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_SetSSRU_IT(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_EnableITSubSecondsUnderflow(void)

HAL RTC deactivate SSRU

HAL1

HAL2

HAL_StatusTypeDef HAL_RTCEx_DeactivateSSRU(RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_DisableITSubSecondsUnderflow(void)

HAL RTC SSRU IRQHandler

HAL1

HAL2

void HAL_RTCEx_SSRUIRQHandler(RTC_HandleTypeDef *hrtc)
void HAL_RTC_SubSecondsUnderflow_IRQHandler(void)

HAL RTC SSRU event callback

HAL1

HAL2

void HAL_RTCEx_SSRUEventCallback(RTC_HandleTypeDef *hrtc)
void HAL_RTC_SubSecondsUnderflowEventCallback(void)

HAL RTC register/unregister callback

HAL1

HAL2

HAL_StatusTypeDef HAL_RTC_RegisterCallback(RTC_HandleTypeDef *hrtc,
                                           HAL_RTC_CallbackIDTypeDef CallbackID,
                                           pRTC_CallbackTypeDef pCallback)

HAL_StatusTypeDef HAL_RTC_UnRegisterCallback(RTC_HandleTypeDef *hrtc,
                                             HAL_RTC_CallbackIDTypeDef CallbackID)
As the RTC handle is removed, the register callback feature is no more provided.
User can customize the weak callback if needed.